package com.koron.tool.convertor;

import com.koron.tool.bean.ToolInventoryBean;
import com.koron.tool.bean.dto.InventoryReportDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @Author: laiguangming
 * @Date: 2022/10/28 8:55
 */
@Mapper
public interface InventoryReportConvertor {

    InventoryReportConvertor INSTANCE = Mappers.getMapper(InventoryReportConvertor.class);

    @Mappings({
            @Mapping(target = "startTime", expression = "java(new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm\").format(bean.getStartTime() * 1000))"),
            @Mapping(target = "endTime", expression = "java(new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm\").format(bean.getEndTime() * 1000))")
    })
    InventoryReportDto toInventoryReportDto(ToolInventoryBean bean);

}
